#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: title02分糖果.py 
@version:
@time: 2023/05/26 
"""


def solve(x):
    count = 0
    while x != 1:
        if x == 3:
            count += 2
            break
        if x % 2 != 0:
            if (x + 1) // 2 % 2 == 0:
                x += 1
            else:
                x -= 1
            count += 1
        x //= 2
        count += 1
    return count


print(solve(15))